<%-- 
    Document   : sample1
    Created on : 2009-7-11, 11:08:16
    Author     : think
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
	<title>Testing Prototype</title>
	<script src="prototype.js"></script>
	<script>
	document.observe('dom:loaded', function() {
		$$('ol#rambolist li').each(function(elmt) {
			elmt.observe('click', function(ev) {
				// Code to respond to each click goes here
				var listitem = ev.target;
				var aboveitems = listitem.previousSiblings();
				if (aboveitems.length > 0)
				{
					var itemtext = aboveitems[0].innerHTML;
					aboveitems[0].innerHTML = listitem.innerHTML;
					listitem.innerHTML = itemtext;
				}
			});
		});
	});
	</script>
</head>
<body>

<ol id="rambolist">
<li>First Blood (1982)</li>
<li>Rambo: First Blood Part II (1985)</li>
<li>Rambo III (1988)</li>
<li>Rambo (2008)</li>
</ol>

</body>
</html>
